package com.example.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.system.domain.bo.UserBo;
import com.example.system.domain.entity.User;
import com.example.system.domain.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserMapper extends BaseMapper<User> {
    UserVo getUserByUsernameVo(@Param("username") String username);

    UserBo getUserByUserIdBo(@Param("userId") int userId);

    User getUserByUserId(@Param("userId") Integer userId);

    List<UserVo> getUserListVo();

    List<User> getUserList();

//    List<UserVo> selectUserLists(@Param("search") String search);

    void updatePwd(@Param("account") String account, @Param("password") String password);

    void updateImage(@Param("account") String account, @Param("id") int id);

    void updateByUserId(@Param("user") User user);

    User getUserByAccount(@Param("account") String account);

    void insertUserList(@Param("list") List<User> list);

    /**
     * 此Mapper，通过角色Id,获取所属该角色的所有用户的账号（account)
     */
    List<String> getUserListByRole(Integer roleId);

    void insertUser(@Param("user") User user);
}
